<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <input type="text" id="inp">
    <div>
        <ul>
            <li>fasdfasd</li>
            <!-- <li>asssggga</li>
            <li>bbwswwrw</li>
            <li>trewqqqf</li> -->
            <!-- <span style="color:red"></span> -->
        </ul>
    </div>
</body>
<script>
    let inpEl = document.querySelector('#inp');
    let liEl = document.querySelector('li');
    inpEl.addEventListener('keyup', (ev) => {
        let searchKey = ev.target.value.trim();
        let liText = liEl.innerText;
        let reg = null;
        if (searchKey) {
            reg = new RegExp(searchKey, 'g');
        }
        if (reg) {
            let res = liText.replace(reg, (searchKey) => {
                return `<span style="color:red">${searchKey}</span>`
            })
            liEl.innerHTML = res;
        }
    })
</script>

</html>